﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TKT.Lifter.CIM.Lifter.Gui.Monitor.Panels
{
    /// <summary>
    /// add by yangshl 2023/5/19
    /// Port的配置功能，每次添加/修改/删除Port都会去操作三个相关联的表
    /// 
    /// </summary>
    public partial class PortConfigControl : UserControl
    {
        public PortConfigControl()
        {
			InitializeComponent();
			InitPortInfoDGV();
			InitLocationUnitInfoDGV();
			InitSubSystemInfoDGV();

		}
        private void InitPortInfoDGV()
        {
			this.PortInfoDGV.AllowUserToAddRows = true;
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.PortInfoDGV.Columns[0].HeaderText = "PortID";
			this.PortInfoDGV.Columns[1].HeaderText = "传输方式";
			this.PortInfoDGV.Columns[2].HeaderText = "Port类型";
			this.PortInfoDGV.Columns[3].HeaderText = "Buffer数量";
			this.PortInfoDGV.Columns[4].HeaderText = "类型";
			this.PortInfoDGV.Columns[5].HeaderText = "是否组合";
			this.PortInfoDGV.Columns[6].HeaderText = "下一个位置";
			this.PortInfoDGV.Columns[7].HeaderText = "特殊楼层";
		}
		private void InitLocationUnitInfoDGV()
        {
			this.LocationUnitInfoDGV.AllowUserToAddRows = true;
			this.LocationUnitInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.LocationUnitInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.LocationUnitInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.LocationUnitInfoDGV.Columns[0].HeaderText = "PortID";
			this.LocationUnitInfoDGV.Columns[1].HeaderText = "PLCID";
			this.LocationUnitInfoDGV.Columns[2].HeaderText = "HostID";
		}
		private void InitSubSystemInfoDGV()
        {
			this.SubSystemInfoDGV.AllowUserToAddRows = true;
			this.SubSystemInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.SubSystemInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.SubSystemInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.SubSystemInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.SubSystemInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.SubSystemInfoDGV.Columns.Add(new DataGridViewTextBoxColumn());
			this.SubSystemInfoDGV.Columns[0].HeaderText = "单元ID";
			this.SubSystemInfoDGV.Columns[1].HeaderText = "单元类型";
			this.SubSystemInfoDGV.Columns[2].HeaderText = "OwnerID";
			this.SubSystemInfoDGV.Columns[3].HeaderText = "Owner类型";
			this.SubSystemInfoDGV.Columns[4].HeaderText = "AssemblyName";
			this.SubSystemInfoDGV.Columns[5].HeaderText = "ClassName";
		}

	}
}
